/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MaintTeam.java
 *
 * Created on 11-feb-2009, 10:25:53
 */
package gui;

import on.Team;

/**
 *
 * Author: Gema Lopez Garcia
 */
public class MaintTeam extends logic.ContentiPanel<Team> {


    /** Creates new form MaintTeam */
    public MaintTeam() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        JLnombre = new javax.swing.JLabel();
        JLliga = new javax.swing.JLabel();
        JLemail = new javax.swing.JLabel();
        JLid = new javax.swing.JLabel();
        JTFnombre = new javax.swing.JTextField();
        JTFid = new javax.swing.JTextField();
        JCBliga = new javax.swing.JComboBox();
        JTFemail = new javax.swing.JTextField();
        JLpersonaContacto = new javax.swing.JLabel();
        JTFpersonaContacto = new javax.swing.JTextField();

        JLnombre.setText("Nombre ");

        JLliga.setText("Liga");

        JLemail.setText("E-m@il");

        JLid.setText("Id");

        JTFid.setEnabled(false);

        JCBliga.setMaximumRowCount(10);
        JCBliga.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SUM", "SUF", "DHM", "DHF", "PDM", "PDF", "SDM", "SDF", "TDM", "ENP" }));

        JLpersonaContacto.setText("Persona Contacto");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(JLnombre)
                            .addComponent(JLliga))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(JTFnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
                                .addComponent(JLid)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(JTFid, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(JCBliga, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(JLpersonaContacto)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(JTFpersonaContacto, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(JLemail)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(JTFemail, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLnombre)
                    .addComponent(JLid)
                    .addComponent(JTFid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JTFnombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLliga)
                    .addComponent(JCBliga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLpersonaContacto)
                    .addComponent(JTFpersonaContacto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JTFemail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLemail))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox JCBliga;
    private javax.swing.JLabel JLemail;
    private javax.swing.JLabel JLid;
    private javax.swing.JLabel JLliga;
    private javax.swing.JLabel JLnombre;
    private javax.swing.JLabel JLpersonaContacto;
    private javax.swing.JTextField JTFemail;
    private javax.swing.JTextField JTFid;
    private javax.swing.JTextField JTFnombre;
    private javax.swing.JTextField JTFpersonaContacto;
    // End of variables declaration//GEN-END:variables

  
   

    @Override
    public void setContenido(Team t) {
        this.JTFnombre.setText(t.getNombre());
        this.JTFid.setText(t.getId_equipo()+"");
        this.JTFemail.setText(t.getEmail());
        this.JTFpersonaContacto.setText(t.getPersona_contacto());
        int posicion= t.posicionLiga(t.getLiga()[t.posicionLiga(t.getTxtLiga())]);
        this.JCBliga.setSelectedIndex(posicion);

        
    }

    @Override
    public Team getContenido() {
       Team t = new Team();
       t.setId_equipo(Integer.valueOf(this.JTFid.getText()));
       t.setNombre(this.JTFnombre.getText());
       t.setEmail(this.JTFemail.getText());
       t.setPersona_contacto(this.JTFpersonaContacto.getText());
       t.setTxtLiga(t.getLiga()[JCBliga.getSelectedIndex()]);
        return t;
    }

    @Override
    public void enableTextFields(boolean boo) {
        this.JTFemail.setEnabled(boo);
        this.JTFnombre.setEnabled(boo);
        this.JTFpersonaContacto.setEnabled(boo);
        this.JCBliga.setEnabled(boo);
    }

    @Override
    public void clearTextFields() {
        this.JTFemail.setText("");
        this.JTFid.setText("");
        this.JTFnombre.setText("");
        this.JTFpersonaContacto.setText("");
        this.JCBliga.setSelectedIndex(0);
    }

 
}
